<template>
    <div>
      <form action="" @submit.prevent="on_submit">
        <input type="text" v-model="name">
        <input type="submit" value="修改">
      </form>
    </div>
</template>

<script>
  import axios from 'axios'
    export default {
        name: "update",
      data:function () {
        return{
          name:""
        }
      },
      methods:{
          on_submit(){
            axios({
              url:"http://127.0.0.1:8000/update/",
              method:"post",
              data:{
                name:this.name,
                id:this.$route.query.id
              }
            }).then(res=>{
              this.$router.push({'name':'index'})
            })
          }
      }
    }
</script>

<style scoped>

</style>
